#pragma once
#include <iostream>
#include <functional>
#include <unistd.h>
#include <string>
#include <cstring>
#include <sys/socket.h>
#include <sys/types.h>
#include <arpa/inet.h>
#include <netinet/in.h>



// void Usage(std::string proc)
// {
//     std::cerr << "Usage:" << proc << "server_ip server_port" << std::endl;
// }




enum ExitCode
{
    OK = 0,
    USAGE_ERR,
    SOCKET_ERR,
    BIND_ERR,
    LISTEN_ERR,
    CONNECT_ERR,
    OPEN_ERR,
    FORK_ERR
};


//禁止拷贝和赋值的基类
class NoCopy
{
    public:
        NoCopy(){}
        ~NoCopy(){}
        NoCopy(const NoCopy&) = delete;
        NoCopy& operator=(const NoCopy&) = delete;
};

//struct sockaddr_in* 转换为 struct sockaddr* 的宏
#define CONV(addr) ((struct sockaddr*)&addr)